// Copyright (c) 2021 Presto Labs Pte. Ltd.
// Author: gekim

#pragma once


#include "coin2/exchange/base/feed/ws/ws_connection.h"

#include <memory>
#include <string>

#include <boost/uuid/uuid_generators.hpp>
#include <glog/logging.h>

#include "coin2/exchange/base/executor/live_executor.h"
#include "coin2/exchange/base/feed/ws/feed_subscription_spec.h"
#include "coin2/exchange/base/market/market_exchange_api.h"

namespace coin2::exchange::base::feed {
namespace impl {
class KucoinConnection : public WsConnection {
 public:
  KucoinConnection(const WsConnectionConfig* config,
                   std::function<void()> fail_callback,
                   executor::LiveAsyncExecutor* exec,
                   RequestGenerator* request_generator,
                   std::shared_ptr<LatencyExtractor> latency_extractor,
                   bool enable_telemetry);

  ~KucoinConnection();

  void Run(boost::asio::yield_context yield) override;

 protected:
  void SchedulePingPong() override;

 private:
  boost::uuids::uuid uuid_;
  int64_t ping_interval_ns_;
};

}  // namespace impl

using impl::KucoinConnection;

}  // namespace coin2::exchange::base::feed
